<template>
  <div class="home">
    <div>我是你爸爸</div>
    <div>{{name1}}</div>
    <button @click="setNameT">修改</button>
  </div>
</template>

<script>
import {mapActions,mapGetters,mapMutations,mapState} from 'vuex'

export default {
  data(){
    return {
      name:''
    }
  },
  computed:{
    ...mapState({
      name1:state=>state.name
    })
  },
  methods:{
    // ...mapActions(['setName']),
    // ...mapMutations(['setName']),
    ...mapActions({
      setName1:'setName'
    }),

    setNameT(){
      this.setName1('丁志冰')
    }
  }
}
</script>
